
package poker.plans.player;

import poker.beliefs.*;
import jadex.runtime.IMessageEvent;
import jadex.runtime.Plan;


public class AddCardsPlan extends Plan {

	public void body() {
		// Get the card/s dealt and add them to the hand
		IMessageEvent request = (IMessageEvent) getInitialEvent();
		DealCard dc = (DealCard) request.getContent();
		Card[] cards = dc.getCards();
		Hand hand = (Hand) getBeliefbase().getBelief("hand").getFact();
		
		for (int i = 0; i < cards.length; i++) {
			hand.addCard(cards[i]);
			System.out.println("PLAYER " + getAgentName() + ": Card received: "+ cards[i].toString());
		}
		getBeliefbase().getBelief("hand").setFact(hand);
	}
}
